"""添加logs和users关系属性

Revision ID: 3ec27cf36548
Revises: 5f967e1f131b
Create Date: 2025-11-19 12:14:02.042421

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '3ec27cf36548'
down_revision: Union[str, Sequence[str], None] = '5f967e1f131b'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('logs', sa.Column('user_id', sa.Integer(), nullable=True, comment='用户ID'))
    op.create_foreign_key(None, 'logs', 'users', ['user_id'], ['id'])
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'logs', type_='foreignkey')
    op.drop_column('logs', 'user_id')
    # ### end Alembic commands ###
